package com.tjhq.commons.dict.util;

import com.tjhq.commons.dict.external.po.DictTFactorPO;
import com.tjhq.commons.dict.external.po.DictTModelPO;
import org.apache.commons.lang3.StringUtils;

/**
 * @author wjp
 * @date 2017/11/3
 */
public class POUtils {
    
    public static void initModelPO(DictTModelPO po) {
        po.setIsadd(StringUtils.isBlank(po.getIsadd()) ? "0" : po.getIsadd());
        po.setIsman(StringUtils.isBlank(po.getIsman()) ? "0" : po.getIsman());
        po.setIspartition(StringUtils.isBlank(po.getIspartition()) ? "0" : po.getIspartition());
        po.setIsreserved(StringUtils.isBlank(po.getIsreserved()) ? "0" : po.getIsreserved());
        po.setIsshow(StringUtils.isBlank(po.getIsshow()) ? "1" : po.getIsshow());
        po.setIstask(StringUtils.isBlank(po.getIstask()) ? "0" : po.getIstask());
        po.setIssumtab(StringUtils.isBlank(po.getIssumtab()) ? "0" : po.getIssumtab());
    }
    
    public static void initFactorPO(DictTFactorPO po) {
        po.setIsbandcol(StringUtils.isBlank(po.getIsbandcol()) ? "0" : po.getIsbandcol());
        po.setIshref(StringUtils.isBlank(po.getIshref()) ? "0" : po.getIshref());
        po.setIskey(StringUtils.isBlank(po.getIskey()) ? "0" : po.getIskey());
        po.setIsleaf(StringUtils.isBlank(po.getIsleaf()) ? "1" : po.getIsleaf());
        po.setIsregex(StringUtils.isBlank(po.getIsregex()) ? "0" : po.getIsregex());
        po.setIsreserve(StringUtils.isBlank(po.getIsreserve()) ? "0" : po.getIsreserve());
        po.setIssum(StringUtils.isBlank(po.getIssum()) ? "0" : po.getIssum());
        po.setIsupdate(StringUtils.isBlank(po.getIsupdate()) ? "1" : po.getIsupdate());
        po.setIsvirtual(StringUtils.isBlank(po.getIsvirtual()) ? "0" : po.getIsvirtual());
        po.setIsvisible(StringUtils.isBlank(po.getIsvisible()) ? "1" : po.getIsvisible());
        po.setNullable(StringUtils.isBlank(po.getNullable()) ? "1" : po.getNullable());
        po.setParentNodeCanCheck(StringUtils.isBlank(po.getParentNodeCanCheck()) ? "0" : po.getParentNodeCanCheck());
        po.setSuperid(StringUtils.isBlank(po.getSuperid()) ? "0" : po.getSuperid());
    }
}
